package zhaoxiaohan.service;

import spring.BeanFactoryAware;
import spring.BeanNameAware;
import spring.DefaultListableBeanFactory;
import spring.InitializingBean;
import spring.annotation.Autowired;
import spring.annotation.Component;
import spring.annotation.Value;

@Component
public class UserService implements  BeanNameAware,BeanFactoryAware, InitializingBean {

    @Autowired
    private OrderService orderService;

    @Value("${a}")
    private String b;

    DefaultListableBeanFactory beanFactory;

    String beanName;


    public OrderService getOrderService() {
        return orderService;
    }

    public void setOrderService(OrderService orderService) {
        this.orderService = orderService;
    }

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }


    @Override
    public void setBeanFactory(DefaultListableBeanFactory beanFactory) {
        this.beanFactory = beanFactory;
    }

    @Override
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化语句");
    }

    public DefaultListableBeanFactory getBeanFactory() {
        return beanFactory;
    }

    public String getBeanName() {
        return beanName;
    }

    public void hello(){
        System.out.println("heool");
    }
}
